import Vue from 'vue'
import App from './App.vue'
import router from './router'
import axios from 'axios'
import VueAxios from 'vue-axios'
import ElementUI from 'element-ui';
import cookies from 'js-cookie'
import 'element-ui/lib/theme-chalk/index.css';
import './router/global'
import './router/permission.js'
import JsonExcel from 'vue-json-excel'
 import moment from 'moment'
 import Print from 'vue-print-nb'




//全局加请求头
axios.defaults.headers.common['X-Litemall-Admin-Token'] = sessionStorage.getItem("token");
Vue.use(ElementUI);
Vue.use(Print);
Vue.use(VueAxios, axios)
Vue.config.productionTip = false
Vue.prototype.$cookie = cookies
Vue.component('downloadExcel', JsonExcel)
 //全局过滤器
 Vue.filter('dateFmt',(input,formatString="YYYY-MM-DD")=>{
     //es5函数参数设置默认值
     //const lastFormatString = formatString || ''

     /**
      * moment(input) 把时间字符串转成时间对象
      * format(formatString) 把时间对象，按照指定格式，格式化成符合条件的字符串
      */
     return moment(input).format(formatString)
 })

new Vue({
	router,
	render: h => h(App)
}).$mount('#app')
